Strip out advice in command docstrings
authorHenrik Lissner <accounts@v0.io>
Thu, 26 Dec 2019 01:27:17 +0000 (20:27 -0500)
committerJustin Burkett <justin@burkett.cc>
Fri, 7 Feb 2020 02:21:01 +0000 (21:21 -0500)
which-key.el

index de96a498fb202458038f3ce2456c8acbaaf2a184..2adda882efdbcbe4a766c0cb42938aba4ba5ed6e 100644 (file)
@@ -1671,7 +1671,12 @@ and `which-key-show-docstrings' is non-nil. If
 return the docstring."
   (let* ((orig-sym (intern original))
          (doc (when (commandp orig-sym)
-                (documentation orig-sym)))
+                (string-trim-left
+                 (documentation orig-sym)
+                 (concat "\\(?::"
+                         "\\(?:\\(?:after\\|before\\)\\(?:-\\(?:until\\|while\\)\\)?\\|around\\|override\\|filter-\\(?:args\\|return\\)\\)"
+                         " advice: [^\n]+\n"
+                         "\\)+\n"))))
          (docstring (when doc
                       (which-key--propertize (car (split-string doc "\n"))
                                              'face 'which-key-docstring-face))))